package com.yakumosakura.yakumoblade.specialeffects.ses;

import com.yakumosakura.yakumoblade.registry.slashblade.YASpecialEffectsRegistry;
import mods.flammpfeil.slashblade.capability.slashblade.ISlashBladeState;
import mods.flammpfeil.slashblade.event.SlashBladeEvent;
import mods.flammpfeil.slashblade.registry.specialeffects.SpecialEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;


public class HexGam extends SpecialEffect {


    public HexGam() {
        super(30);

    }

    public static void onSlashBladeUpdate(SlashBladeEvent.UpdateEvent event) {
        ISlashBladeState state = event.getSlashBladeState();
        if(state.hasSpecialEffect(YASpecialEffectsRegistry.HexGamFox.getId())||state.hasSpecialEffect(YASpecialEffectsRegistry.HexGamDragon.getId())) {
            if (!(event.getEntity() instanceof Player)) {
                return;
            }

            if(!event.isSelected())
                return;

            Player player = (Player) event.getEntity();

            int level = player.experienceLevel;
            if (!player.hasEffect(MobEffects.ABSORPTION)){
                if(SpecialEffect.isEffective(YASpecialEffectsRegistry.HexGamFox.get(),level)||SpecialEffect.isEffective(YASpecialEffectsRegistry.HexGamDragon.get(),level)){
                    player.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 300, 4));
                    player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 300, 2));
                    player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 300, 1));
                }}
        }
    }
}
